<template>
  <div>
    <span @click="changeColor">学vue</span>
  </div>
</template>
<script>
export default {
  methods: {
    changeColor (e) {
      e.target.style.color = 'red'
    }
  },
  activated () {
    console.log('keep-alive组件进入啦!')
  },
  deactivated () {
    console.log('keep-alive组件退出啦!')
  },
  // 路由钩子函数
  beforeRouteEnter (to, from, next) {
    next()
  },
  beforeRouteLeave (to, from, next) {
    console.log('routeLeave')
    next()
  }
}
</script>
<style lang='less' scoped>
</style>
